package knowledgeSources;

import java.util.ArrayList;

import expertSystem.IKnowledgeBase;
import expertSystem.IKnowledgeSource;
import expertSystem.Knowledge;
import expertSystem.KnowledgeType;

public abstract class BaseKnowledgeSource implements IKnowledgeSource
{

	@Override
	public abstract String Name(); 
	
	//===========================================================================
	@Override
	public abstract String Run(IKnowledgeBase KBase);
	
	//===========================================================================
	public Knowledge getKnowledge(IKnowledgeBase KBase,KnowledgeType type,String tag) 
	{		
		ArrayList<Knowledge> Imgs = KBase.Get(type);
		if(Imgs == null)
			return null;
		for (Knowledge oKnowledge : Imgs) 
		{
			if(oKnowledge.Tag() == tag)
			{
				return oKnowledge;				
			}			
		}
		return null;
	}
	//===========================================================================
}
